<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>选择品规</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
                            
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label for="qualityspecName">通用名：</label>
                        <input class="form-control" type="text" id="qualityspecName" placeholder="品规名称" maxlength="200" />
                    </div>
                     <div class="form-group form-group-xs">
                        <label for="form">剂型：</label>
                        <input class="form-control" type="text" id="form" placeholder="剂型" maxlength="200" />
                    </div> 
                    <div class="form-group form-group-xs">
                        <label for="spec">规格：</label>
                        <input class="form-control" type="text" id="spec" placeholder="规格" maxlength="200" />
                    </div>
                    <button type="button" class="btn btn-success btn-sm" onclick="search();">查询</button>
                    <input class="form-control" id="projId" name="projId" type="hidden"  value="${projId}">
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup">
            <button type="button" id="confirm"  onclick="confirm();" class="btn btn-default btn-sm">确认</button>
        </div>
  
    </section>
    
   <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    
    <script type="text/javascript">
        
        
        function search(page) {
            var qualityspecName = $.trim($("#qualityspecName").val());
            var qualityspecNameEng = $.trim($("#qualityspecNameEng").val());
            var form = $.trim($("#form").val());
            var spec = $.trim($("#spec").val());
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"qualityspecName":qualityspecName, "qualityspecNameEng":qualityspecNameEng, "form":form, "spec": spec},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/prodDrug/getDrugSelectQualityspec.html?projId=${projId}",
                mtype: "post",
                datatype: "json",
                autowidth: true,
                height: 270,
                colNames: [
                    '品规id',
                    '品规编码', 
                    '通用名', 
                    '通用名英文',
                    '剂型', 
                    '规格'
                ],
                colModel: [
                    { name: 'qualityspecId',width: 100,hidden:true, align:"center", sortable: false},
                    { name: 'qualityspecCode',hidden:true, width: 100, align:"center", sortable: false },
                    { name: 'qualityspecName', width: 140, align:"left", sortable: false},
                    { name: 'qualityspecNameEng', width: 140, align:"left", sortable: false},
                    { name: 'form', width: 80, align:"center", sortable: false},
                    { name: 'spec', width: 80, align:"left", sortable: false}
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "品规列表",
                jsonReader: {
                    id: "qualityspecId"
                }
            });
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            

            $(window).trigger("resize");
            
        });
        
      //确认
        function confirm() {
            var rowId = $("#gridlist").jqGrid("getGridParam", "selrow") || [];
             if(rowId.length <=0){
                $.HN.message.alert("请选择要操作的行！", "消息", "warn");
                return;
             }
             var rowdata = $("#gridlist").jqGrid('getRowData', rowId);
             var dialog = top.dialog.get(window);
             var params = {
                "qualityspecId" : rowdata.qualityspecId,
                "qualityspecName" : rowdata.qualityspecName,
                "qualityspecNameEng" : rowdata.qualityspecNameEng,
                "form" : rowdata.form,
                "spec" : rowdata.spec
             };
             dialog.close(params);   // 关闭（隐藏）对话框
             dialog.remove();        // 主动销毁对话框
        }
    </script>
</body>
</html>












